<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/css/login.css">
</head>
<body>
    <div class="login-wrap">
        <div class="loginCont">
            <div class="login_tit">
                管理员登录
            </div>
            <form method="post" action="/login" onsubmit="return check();">
                <div class="input-group">
                    <img class="icon" src="/img/person.png">
                    <input type="text" name="username" id="username" value="" placeholder="请输入账号" />
                </div>
                <div class="input-group">
                    <img class="icon" src="/img/password.png">
                    <input type="password" id="password" name="password" placeholder="请输入密码" />
                </div>
                <p id="err" th:text="${err}"></p>
                <button class="loginBtn">登录</button>
            </form>
        </div>
    </div>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <script type="text/javascript">
        $(".input-group input").click(function () {
            $(".input-group").css("borderColor", "#ddd");
            $(this).parent().css("borderColor", "#0689e4");
        })
        function check() {
            let username = $("#username").val(), password = $("#password").val();
            if (!username || username.trim() === "") return showMsg("请输入账号");
            if (!password || password.trim() === "") return showMsg("请输入密码");
            return true
        }
        //错误信息提醒
        function showMsg(msg) {
            $("#err").show().text(msg);
            $(".loginBtn").css("margin-top","0px")
            return false
        }
        if (self.location !== top.location) {
            top.location = self.location;
        }
    </script>
</body>

</html>    